
Device: CY8C24794
Created: PSoC Designer version 4.2 b1013 with Service Pack 2
Copyright: Cypress Semiconductor, all rights reserved, 2005

Purpose

This PSoC Designer project is intended to provide an example of using
an "alternate" inteface that performs IN transactions with isochronous
communication.

Files

Certain files have been modified, described as follows:

main.c - Holds the interrupt handler for the isochronous end point (EP1).
	Also, the main (foreground) processing has logic to initialize the
	isochronous environment, based on flags set in custom code added to
	the USB user module (see below) and fill EP1 with data.

usbfs_1int.asm - Jumps to the ISR in main.c

usbfs_1_descr.asm - To bypass the descriptors generated by the wizard. 
	The WIZARD equate is set to zero (0) and the ELSE block contains 
	the descriptor support for an Alternate interface. The content of
	the ELSE descriptor block was effectively a cut and paste of the
	wizard generated descriptors with small changes to realize an
	alternate interface.  I might be usefull to compare the descriptor
	tables between the Wizard and ELSE block.

usbfs_1_std.asm - In order to realize the ability to switch to an alternate 
	interface, since the USB user module wizard does not (circa SP2) provide 
	this capability, the following code was added to the USB "state machine" 
	in usbfs_1_std.asm below the USBFS_1_DT_h2d_std_ifc_Dispatch function.

; -- CUT START --
    
   ;---------------------------------------------------
   ;@PSoC_UserCode_BODY_2@ (Do not change this line.)
   ;---------------------------------------------------
   ; Add your custom Interface change logic below
   ;---------------------------------------------------    
      ; 0B is a Set Interface
      cmp	  A, 0Bh
      jnz	  NotS
      mov a, REG[USBFS_1_EP0DATA + wValue]
      ; TODO: check which interface we are setting and clear its endpoints (valid bit) and pointers
      mov [_AltInfSet], a
      cmp a, 1
      jnz NotAlt
      jmp AltDone
  NotAlt: 
  	and reg[USBFS_1_INT_REG], ~USBFS_1_INT_EP1_MASK   
  AltDone:
      jmp USBFS_1_NoDataStageControlTransfer
  NotS:
    
   ;---------------------------------------------------
   ; Insert your custom code above this banner
   ;---------------------------------------------------
   ;@PSoC_UserCode_END@ (Do not change this line.)    
    
; -- CUT END --

When you invoke a "Generate Source" action these changes are overwritten, unless you
add the "custom code" markers (;@PSoC_UserCode_BODY_2@ and ;@PSoC_UserCode_END@)
into the USB user module source file template used during "Generate Source". The template
for this file is located in the PSoC Designer installation folder:

 ..\Data\Stdum\USBFS\USB_std.asm
 
If these changes are erased due to a "Generate Source" you should find the function 
and insert the code from above.  The function shown below is an example the the code
following a "Generate Source":

USBFS_1_DT_h2d_std_ifc_End:
USBFS_1_DT_h2d_std_ifc_Size: equ (USBFS_1_DT_h2d_std_ifc_End-USBFS_1_DT_h2d_std_ifc) / 2
USBFS_1_DT_h2d_std_ifc_Dispatch::
   mov   A, REG[USBFS_1_EP0DATA + bRequest]
   DISPATCHER USBFS_1_DT_d2h_std_ifc, USBFS_1_DT_d2h_std_ifc_Size, USBFS_1_Not_Supported 

ADD THE CUSTOM CODE BETWEEN THE "MOV" AND "DISPATCH" LINES.